import axios from '@/common/axios';
import { API_URL } from '@/common/constants';

export const queryPbomList = async (json) => {
  const { data } = await axios.post(`${API_URL}pbom/queryPbomList`, json);
  return data;
};

export const savePbom = async (json) => {
  const { data } = await axios.post(`${API_URL}pbom/savePbom`, json);
  return data;
};
export const addPbom = async (json) => {
  const { data } = await axios.post(`${API_URL}pbom/addPbom`, json);
  return data;
};
export const delPbom = async (FID, FNumber, entryId) => {
  const { data } = await axios.get(`${API_URL}pbom/delPbom/${FID}/${FNumber}/${entryId}`);
  return data;
};

export const queryPbom = async (json) => {
  const { data } = await axios.post(`${API_URL}pbom/queryPbom`, json);
  return data;
};

export const queryMaterMeta = async () => {
  const { data } = await axios.get(`${API_URL}pbom/queryMaterMeta`);
  return data;
};

export const exportData = async (json) => {
  const { data } = await axios.post(`${API_URL}pbom/exportData`, json, {
    responseType: 'blob',
  });
  return data;
};
